package com.itheima.collectionsdemo;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;

public class Test {

    public static void main(String[] args) {

        //Collections工具类的常用静态方法

        List<String> list = new ArrayList<>();
        /*list.add("hello");
        list.add("world");
        list.add("java");
        list.add("Python");
        list.add("CSS");
        System.out.println(list);*/

        //1.批量添加数据：Collections.addAll();
        Collections.addAll(list,"hello","world","java","Python","CSS");
        System.out.println(list);
        System.out.println("------------------------------------");

        //2.打乱顺序：Collections.shuffle();
        Collections.shuffle(list);
        System.out.println(list);
        System.out.println("------------------------------------");

        //3.排序：Collections.sort();
        Collections.sort(list);
        System.out.println(list);
        System.out.println("------------------------------------");

    }
}
